import axios from "axios";
import { useEffect, useState } from "react";
import NoteContent from "./NoteContent";
import NoteDownload from "./NoteDownload";
import NoteUpload from "./NoteUpload";
import "./Note.css";

export default function Note({ videoTimeStamp }: { videoTimeStamp: number }) {
  const [content, setContent] = useState("");
  const [name, setName] = useState("");
  useEffect(() => {
    async function getMd() {
      const r = (
        await axios.get("http://110.42.231.196:8000/video/notes?videoId=1")
      ).data;
      setContent(r);
    }
    getMd();
    setName("test.md");
  }, []);

  return (
    <div className="Note-container">
      <NoteContent content={content} setContent={setContent} videoTimeStamp={videoTimeStamp}></NoteContent>
      <NoteDownload content={content} name={name}></NoteDownload>
      <NoteUpload></NoteUpload>
    </div>
  );
}
